//
//  OEUserDataController.m
//  OneEightyNine
//
//  Created by apple on 2019/3/3.
//  Copyright © 2019 stoneobs. All rights reserved.
//

#import "OEUserDataController.h"

@implementation OEUserDataController
+ (void)sendFetchUserInfoRequest:(OEUserDataNormalHandle)handle{
//    [SVProgressHUD showWithStatus:@"正在加载"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=index"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(YES,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}

//获取年龄列表
+ (void)sendFetchAgeListRequest:(OEUserDataNormalHandle)handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=ageList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(YES,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
//获取性别列表
+ (void)sendFetchSexListRequest:(OEUserDataNormalHandle)handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=sexList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(YES,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
//查询二维码
+ (void)sendQrCodeMoneyRequest:(void(^)(NSString * qrcode))handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=qrCode"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     NSString * qr_thumb = [modelDic[@"qr_thumb"] description];
                                                     handle(qr_thumb);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(@"0");
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
#pragma mark --修改
+ (void)sendChangeHeaderRequest:(UIImage *)image handle:(OEUserDataNormalHandle)handle{
    [SVProgressHUD showWithStatus:@"Waiting please"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=thumbEdit"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] imageRequestWithPath:url parameters:paramDic image:image imageName:@"thumb" progress:^(NSProgress *progress) {
        
    } success:^(NSURLSessionDataTask *operation, id responseObject) {
        if (handle) {
            handle(YES,@"",nil);
        }
        [SVProgressHUD dismiss];
         [SVProgressHUD showSuccessWithStatus:OESTRING(@"upload success")];
        
    } failure:^(NSString *stateCode, STError *error, NSError *originError) {
        if (handle) {
            handle(NO,@"upload error",nil);
        }
        [SVProgressHUD dismiss];
        [SVProgressHUD showErrorWithStatus:OESTRING(@"upload error")];
    }];
}
+ (void)sendChangeValueRequest:(NSString *)value key:(NSString *)key hadle:(OEUserDataNormalHandle)handle{
    [SVProgressHUD showWithStatus:@"Waiting please"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
     NSString * method = @"";
    if ([key isEqualToString:@"user_name"]) {
        method = @"usernameEdit";
    }
    if ([key isEqualToString:@"new_mobile"]) {
        method = @"mobileEdit";
        [paramDic setObject:OE_PHONE_PREFIX forKey:@"prefix"];
    }
    if ([key isEqualToString:@"sex"]) {
        method = @"sexEdit";
    }
    if ([key isEqualToString:@"age"]) {
        method = @"ageEdit";
    }
    if (key && value) {
        [paramDic setObject:value forKey:key];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=",method];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(NO,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
#pragma mark --查询x余额
+ (void)sendFetchMoneyRequest:(void (^)(NSString * _Nonnull))handle{
//    [SVProgressHUD showWithStatus:@"请稍后"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=walletIndex"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     NSString * user_money = [modelDic[@"user_money"] description];
                                                     handle(user_money);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(@"0");
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
//查询充值押金金额
+ (void)sendFetcBeVipMoneyRequest:(void(^)(NSString * money))handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=rechargeShow"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSString * content = [[responseObject valueForKey:@"content"] description];
                                                 if (handle) {
                                                     
                                                     handle(content);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(@"0");
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}

#pragma mark --通用
+ (void)sendGetPayMethod:(OEUserDataNormalHandle)handle{
    [SVProgressHUD showWithStatus:@"Waiting please"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
  
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=paymentList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(NO,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
//支付
+ (void)sendPayRequestWithMoney:(NSString*)money pay_id:(NSString*)pay_id handle:(OEUserDataNormalHandle)handle{
    [SVProgressHUD showWithStatus:@"Waiting please"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    if (money.length) {
        [paramDic setObject:money forKey:@"money"];
    }
    if (pay_id.length) {
        [paramDic setObject:pay_id forKey:@"pay_id"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=recharge"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(NO,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}

#pragma mark --通用 获取预定选择列表 id,title group获取
+ (void)sendPresuppositionGroupRequestWithHandle:(void (^)(BOOL, NSArray * _Nonnull, NSArray * _Nonnull, NSArray * _Nonnull))handle{
    
    dispatch_group_t group =  dispatch_group_create();
   [SVProgressHUD showWithStatus:@"Waiting please"];
   __block NSArray * fengweiArray;
   __block NSArray * ricepointArray;
   __block NSArray * peopleArray;
    
     dispatch_group_enter(group);
    [self sendPeopleListRequestHandle:^(bool success, NSArray *array) {
        peopleArray = array;
        dispatch_group_leave(group);
        
    }];
     dispatch_group_enter(group);
    [self sendFengweiRequestHandle:^(bool success, NSArray *array) {
        fengweiArray = array;
        dispatch_group_leave(group);
    }];
    dispatch_group_enter(group);
    [self sendRicePointRequestHandle:^(bool success, NSArray *array) {
        ricepointArray = array;
        dispatch_group_leave(group);
    }];
    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        if (handle) {
            handle(YES,fengweiArray,ricepointArray,peopleArray);
        }
        [SVProgressHUD dismiss];
    });
}
+ (void)sendFengweiRequestHandle:(void(^)(bool success,NSArray * array))handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=flavorList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSArray * array = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,array);
                                                 }
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 //                                                 [self.tableView.mj_header endRefreshing];
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 ;
                                                 if (handle) {
                                                     handle(NO,nil);
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
+ (void)sendRicePointRequestHandle:(void(^)(bool success,NSArray * array))handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=mealList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSArray * array = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,array);
                                                 }
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 //                                                 [self.tableView.mj_header endRefreshing];
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 ;
                                                 if (handle) {
                                                     handle(NO,nil);
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
+ (void)sendPeopleListRequestHandle:(void(^)(bool success,NSArray * array))handle{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=Common&a=peopleList"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSArray * array = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,array);
                                                 }
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 //                                                 [self.tableView.mj_header endRefreshing];
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 ;
                                                 if (handle) {
                                                     handle(NO,nil);
                                                 }
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}

#pragma mark --通用 更新当前 地址
+ (void)sendUpdateLocationRequest{
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }else{
        return;
    }
    if (STLocationManger.defult.ipx.length) {
        [paramDic setObject:STLocationManger.defult.ipx forKey:@"ipx"];
    }
    if (STLocationManger.defult.ipy.length) {
        [paramDic setObject:STLocationManger.defult.ipy forKey:@"ipy"];
    }
    
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?c=User&a=currentPosition"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 
                                                 // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
//                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}

//设置支付密码
+ (void)sendChangePayPwdRequest:(NSString*)pwd hadle:(OEUserDataNormalHandle)handle{
    [SVProgressHUD showWithStatus:@"Waiting please"];
    NSMutableDictionary * paramDic = [NSMutableDictionary new];
    NSString * token = STUserManger.defult.loginedUser.token;
    if (token.length) {
        [paramDic setObject:token forKey:@"user_token"];
    }
    if (pwd.length) {
        [paramDic setObject:pwd forKey:@"pay_password"];
    }
    NSString * url = [NSString stringWithFormat:@"%@%@",releaseServerUrlHeader,@"index.php?m=Front&c=User&a=payPwdEdit"];
    DDLogInfo(@"url:%@",url);
    DDLogInfo(@"param:%@",paramDic);
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:paramDic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 [SVProgressHUD dismiss];
                                                 NSDictionary * modelDic = [responseObject valueForKey:@"content"];
                                                 if (handle) {
                                                     handle(YES,@"",modelDic);
                                                 }
                                                 DDLogInfo(@"%@请求成功:resp\n%@",url,responseObject);
                                                 
                                                 
                                             } failure:^(NSString *stateCode, STError *error,NSError *originError) {
                                                 [SVProgressHUD dismiss];
                                                 if (handle) {
                                                     handle(NO,@"",nil);
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                                 DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                                                            url,paramDic,error.desc,error.code);
                                             }];
}
@end
